import hashlib
import re


def extract_num(text):
    """
    从字符串中提取出数字
    :param text:
    :return:
    """
    match_re = re.match(".*?(\d+).*", text)
    if match_re:
        num = int(match_re.group(1))
    else:
        num = 0
    return num

def get_md5(url):
    if isinstance(url, str):
        url = url.encode("utf-8")
    m = hashlib.md5()
    m.update(url)
    return m.hexdigest()
